﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace FeedBack.Models
{
    public class ContactRepository
    {

        FeedBackDataContext db = new FeedBackDataContext();

        public IQueryable<Contact> FindAllContact()
        {
            return from c in db.Contacts
                   select c;
        }

        public Contact GetUser(int id)
        {
            return db.Contacts.SingleOrDefault(c => c.MemberID == id );
        }

        public void Add(Contact c)
        {
            db.Contacts.InsertOnSubmit(c);
        }

        public void Delete(Contact c)
        {
            db.Contacts.DeleteOnSubmit(c);
        }

        public void Save()
        {
            db.SubmitChanges();
        }
            
    }
}